<page-header model="navModel"></page-header>

<div class="page-container page-body">
  <div class="signup">
    <h3 class="p-b-1">重置密码</h3>

    <div ng-if="ldapEnabled || authProxyEnabled">
      启用LDAP或身份验证代理身份验证后，您将无法重置密码。
    </div>
    <div ng-if="disableLoginForm">
      禁用登录表单后，无法重置密码。
    </div>
    <form
      name="sendResetForm"
      class="login-form gf-form-group"
      ng-show="mode === 'send'"
      ng-hide="ldapEnabled || authProxyEnabled || disableLoginForm || mode === 'reset'"
    >
      <div class="gf-form">
        <span class="gf-form-label width-7">用户</span>
        <input
          type="text"
          name="username"
          class="gf-form-input max-width-14"
          required
          ng-model="formModel.userOrEmail"
          placeholder="电子邮件或用户名"
        />
      </div>
      <div class="gf-form-button-row">
        <button type="submit" class="btn btn-primary" ng-click="sendResetEmail();" ng-disabled="!sendResetForm.$valid">
          重置密码
        </button>
        <a href="login" class="btn btn-inverse">
          返回
        </a>
      </div>
    </form>
    <div ng-show="mode === 'email-sent'">
      带有重置链接的电子邮件已发送到该电子邮件地址。 <br />
      您应该尽快收到。
      <div class="p-t-1">
        <a href="login" class="btn btn-primary p-t-1">
          登陆
        </a>
      </div>
    </div>
    <form name="resetForm" class="login-form gf-form-group" ng-show="mode === 'reset'">
      <div class="gf-form">
        <span class="gf-form-label width-9">新密码</span>
        <input
          type="password"
          name="NewPassword"
          class="gf-form-input max-width-14"
          required
          ng-minlength="4"
          ng-model="formModel.newPassword"
          placeholder="密码"
          watch-change="formModel.newPassword = inputValue;"
        />
      </div>
      <div class="gf-form">
        <span class="gf-form-label width-9">确认密码</span>
        <input
          type="password"
          name="ConfirmPassword"
          class="gf-form-input max-width-14"
          required
          ng-minlength="4"
          ng-model="formModel.confirmPassword"
          placeholder="确认密码"
        />
      </div>
      <div class="signup__password-strength">
        <password-strength password="formModel.newPassword"></password-strength>
      </div>
      <div class="gf-form-button-row">
        <button type="submit" class="btn btn-primary" ng-click="submitReset();" ng-disabled="!resetForm.$valid">
          重置密码
        </button>
      </div>
    </form>
  </div>
</div>

<footer />
